package com.yang.jdbc01;

import com.yang.util.JDBCUtil;
import com.yang.util.JDBCUtil01;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 * @author yangjiming
 * @create 2021-03-26 20:56
 */
public class TestJDBC {
    public static void main(String[] args) throws Exception {
        String sql="select * from student";
        Connection conn = JDBCUtil01.getConnection();
        PreparedStatement ps=conn.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();

        while(rs.next()){
            String name=rs.getString("name");
            System.out.println(name);
        }
        JDBCUtil01.closeAll(rs,ps,conn);
    }
}
